#ifndef TOOLS_HPP
#define TOOLS_HPP

namespace smeg {
    namespace tools {

////////////////////////////////////////////////////////////
/// Wrap the variable _Var from _Begin to _End
///
/// - if _Var < _Begin
///     then _Var = _Var +  _End - _Begin
///     (eg. _Var = 0, _End = 10, _Begin = 2 => return 8)
///
/// - if _Var >= _End 
///     then _Var = _Var + _Begin - _End
///     (eg. _Var = 13, _End = 10, _Begin = 2 => return 5)
///
/// - otherwise _Var stay unchanged
///
/// \param _Var :      Variable to wrap
/// \param _End :      Limit max
/// \param _Begin :    Limit min (default to 0)
///
////////////////////////////////////////////////////////////
template <typename T>
T Wrap( T _Var, T _End, T _Begin = 0 );

////////////////////////////////////////////////////////////
/// Clamp the variable from _Begin to _End
///
/// \param _Var :      Variable to clamp
/// \param _Begin :    Clamp min (default to 0)
/// \param _End :      Clamp max (default to 1)
///
////////////////////////////////////////////////////////////
template <typename T>
T Clamp( T _Var, T _Begin = 0, T _End = 1 );

#include "Tools.inl"

    } // smeg::tools
} // smeg

#endif // TOOLS_HPP
